<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,org.apache.struts.util.LabelValueBean" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/dieBankReport.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<%

    String productId     = request.getParameter("product");
    String partNumber    = request.getParameter("partnumber");

    if( partNumber == null || ( partNumber != null && partNumber.trim().length() == 0 ) )
    {
        partNumber = "0";
    }
    if( productId == null || ( productId != null && productId.trim().length() == 0 ) )
    {
        productId = "0";
    }
%>

<html>
    <HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
    </HEAD>
    <BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
    <script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
    <script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
    <SCRIPT language="JavaScript">

    function submitPage()
    {
		var d = new Date();
		var day = d.getDate();
		var month = d.getMonth()+1;
		var year = d.getFullYear();
		var hour = d.getHours();
		var min = d.getMinutes();
		var sec = d.getSeconds();
        var form = document.yieldGraphReportForm;
		var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
		var reporttype        = "";
        var errorObj =  document.getElementById("errors")
        errorObj.innerHTML = '';

        var processType = form.processType;
        if( processType.value == '-1' )
        {
            errorObj.innerHTML = "<li> Please select Process Type";
            form.processType.focus();
            return false;
        }
        var processStepIds = form.partNumber
        if( processStepIds.value == '' )
        {
            errorObj.innerHTML = "<li> Please select atleast one Part Number";
            return false;
        }
        var commaSeparatedProcessStepIds = '';
        for( var i =0; i < processStepIds.options.length; i++)
        {
            if( processStepIds.options[i].selected )
            {
                commaSeparatedProcessStepIds = commaSeparatedProcessStepIds + processStepIds.options[i].value + ',';
            }
        }
        form.prompt0.value  = processType.value;
        form.prompt1.value  = commaSeparatedProcessStepIds.substring(0, commaSeparatedProcessStepIds.length-1);
		form.prompt2.value  = defaultPrompt;
		form.prompt3.value  = '';
		form.prompt4.value  = '';
		form.prompt5.value  = '';
		form.prompt6.value  = '';
		form.prompt7.value  = '';
		form.prompt8.value  = '';
		form.prompt9.value  = '';
		form.prompt10.value = '';

		form.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/Yield_Graph_by_WW.rpt";
    }

    </script>
    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
      <TBODY >
      <TR>
        <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

        <!-- Side Navigation start -->
        <%@ include file="/jsp/operations/reports_side_menu.jsp" %></TD>
        <!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">

        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
        <!-- from here your body starts -->
        <html:form name="yieldGraphReportForm" action="/yieldGraphReport" type="com.scalar.chiptrack.operations.reports.forms.YieldGraphForm" method= "post">
        <input type="hidden" name="prompt0">
        <input type="hidden" name="prompt1">
        <input type="hidden" name="prompt2">
        <input type="hidden" name="prompt3">
        <input type="hidden" name="prompt4">
        <input type="hidden" name="prompt5">
        <input type="hidden" name="prompt6">
        <input type="hidden" name="prompt7">
        <input type="hidden" name="prompt8">
        <input type="hidden" name="prompt9">
        <input type="hidden" name="prompt10">

        <TABLE width='75%' align=center cellpadding='3' cellspacing='2' border='0' bordercolor='black'>
                <TR><Td colspan='4' class="NArialW" align=center>Yield Graph Report By Work Week</td></tr>
                <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
                <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
                <TR><TD colspan='4' id="chiptracErrors"><chiptrack:errors styleClass="NArialL"/></TD></TR>
                <TR><TD colspan='4'><chiptrack:info styleClass="NArialL"/></TD></TR>
                <tr>
                    <td width="15%" class="NArialL">Process Type</td>
                    <td width="20%" class="NArialL">
                        <html:select name="yieldGraphReportForm" property="processType" styleClass="txfield" onchange="submit()">
                            <html:option value="-1">Select Process Type</html:option>
                           <%-- <html:option value="Assembly">ASSEMBLY</html:option>
                            <html:option value="Test">TEST</html:option>--%>
                            <html:option value="Class Store">PROGRAM</html:option>
                         </html:select>
                    </td>
                    <td colspan='2'>&nbsp;</td>
                </tr>
                    <td width="15%" class="NArialL">Base Product</td>
                    <td width="20%" class="NArialL">
                        <html:select name="yieldGraphReportForm" property="baseProductId" styleClass="txfield" onchange="submit()">
                            <html:option value="-1">All Base Products</html:option>
                            <html:options collection="baseProductList" property="value" labelProperty="label"/>
                         </html:select>
                    </td>
                    <logic:present name="partNumberList">
                            <td width="15%" class="NArialL">Part Number</td>
                            <td width="20%" class="NArialL">
                                <html:select name="yieldGraphReportForm" property="partNumber" styleClass="emptyList" multiple="true" size="5">
                                    <html:options collection="partNumberList" property="value" labelProperty="label"/>
                                 </html:select>
                            </td>
                     </logic:present>
                    <logic:notPresent name="partNumberList">
                            <td width="15%" class="NArialL">Part Number</td>
                            <td width="20%" class="NArialL">
                                <html:select name="yieldGraphReportForm" property="partNumber" styleClass="emptyList" multiple="true" size="5">
                                 </html:select>
                            </td>
                     </logic:notPresent>
                </tr>
                </tr>
                <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
                <tr>
                    <td width="70%" colspan=5 align="center">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="image" onClick="javascript:return submitPage();"  border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Report';return true"onmouseout="window.status='';return true"title="Click here to Generate Report">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:document.yieldGraphReportForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></a>
                    </td>
                </tr>
     </table>
     </html:form>
     <!-- till here -->
     <BR><BR>
     </TD><TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD></TR>
     </TABLE>
     <!-- Footer starts here -->
     <%@ include file="/jsp/includes/footer.jsp" %>
     <!-- footer end here -->
    </body>
</html>

